package com.offcn.service.Impl;

import com.offcn.dao.CourseDetailDao;
import com.offcn.dao.Impl.CourseDetailDaoImpl;
import com.offcn.entity.CourseDetail;
import com.offcn.service.CourseDetailService;

import java.util.ArrayList;
import java.util.List;

public class CourseDetailServiceImpl implements CourseDetailService {
    CourseDetailDao dao = new CourseDetailDaoImpl();
    @Override
    public int addDetail(CourseDetail detail) {
        return dao.addDetail(detail);
    }

    @Override
    public List<CourseDetail> findByCid(int cid) {
        return dao.findByCid(cid);
    }

    @Override
    public List<String> findByType(String cid) {
        List<Object> objs = dao.findByCid(cid);
        List<String> list = new ArrayList<>();
        for (Object o : objs) {
            list.add(o.toString());
        }
        return list;
    }
}
